package com.prs.crm.action.crm;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.IngresDialect;

import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.context.Constrains;
import com.prs.crm.context.FileUtil;
import com.prs.crm.context.ToolKits;
import com.prs.crm.domain.crm.CodeNumber;
import com.prs.crm.domain.crm.Customer;
import com.prs.crm.domain.crm.CustomerAddress;
import com.prs.crm.domain.crm.CustomerAgent;
import com.prs.crm.domain.crm.CustomerDegree;
import com.prs.crm.domain.crm.CustomerLevel;
import com.prs.crm.domain.crm.CustomerProject;
import com.prs.crm.domain.crm.CustomerSales;
import com.prs.crm.domain.crm.CustomerSource;
import com.prs.crm.domain.crm.CustomerTrade;
import com.prs.crm.domain.crm.CustomerType;
import com.prs.crm.domain.crm.DocumenTary;
import com.prs.crm.domain.crm.DocumenTaryStyle;
import com.prs.crm.domain.crm.Linkman;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.sys.Code;
import com.prs.crm.domain.sys.CodeCommon;
import com.prs.crm.exception.InValidDeleteException;
import com.prs.crm.service.crm.CodeNumberService;
import com.prs.crm.service.crm.CustomerAddressService;
import com.prs.crm.service.crm.CustomerDegreeService;
import com.prs.crm.service.crm.CustomerLevelService;
import com.prs.crm.service.crm.CustomerProjectService;
import com.prs.crm.service.crm.CustomerSalesService;
import com.prs.crm.service.crm.CustomerService;
import com.prs.crm.service.crm.CustomerSourceService;
import com.prs.crm.service.crm.CustomerTradeService;
import com.prs.crm.service.crm.CustomerTypeService;
import com.prs.crm.service.crm.DocumenTaryService;
import com.prs.crm.service.crm.DocumenTaryStyleService;
import com.prs.crm.service.crm.LinkmanService;
import com.prs.crm.service.sys.CodeCommonService;
import com.prs.crm.service.sys.CodeService;

public class CustomerAction extends BaseAction {

	private static final long serialVersionUID = 1L;

	private Customer customer;
	private CustomerAgent customerAgent;
	private CustomerProject customerProject;
	private CodeNumber codeNumber;
	private Person person;
	
	private CodeNumberService codeNumberService;
	private CustomerService customerService;
	private PaginationSupport pagination;
	private Integer[] customerIds;
	private Integer[] projectIds;
	private File upload;
	private String uplodS;
	private String uploadFileName;
	private String tradeIds;

	private List<CustomerLevel> levels;
	private List<CustomerType> types;
	private List<CustomerTrade> trades;
	private List<CustomerAddress> addresses; //地址集合
	private List<CustomerSource> sources;  //来源
	private List<CustomerDegree> degrees;  //重要程度
	private List<DocumenTaryStyle> styles; //跟单方式
	private List<CustomerSales> saless;  //销售组
	private List<DocumenTary> tarys;   //跟单集合
	private List<Linkman> linkmans;  //联系人集合
	private List<CustomerProject> projects;  //项目集合
	

	private CustomerLevelService customerLevelService;
	private CustomerTypeService customerTypeService;
	private CustomerTradeService customerTradeService;
	private CustomerAddressService customerAddressService;
	private CustomerSourceService customerSourceService;
	private CustomerDegreeService customerDegreeService;
	private DocumenTaryStyleService documenTaryStyleService;
	private CustomerSalesService customerSalesService;
	private DocumenTaryService documenTaryService;
	private LinkmanService linkmanService;
	private CustomerProjectService customerProjectService;
	private Map<String, String> alist;

	private boolean text = false;

	private CodeCommon codeCommon;
	private CodeCommonService codeCommonService;

	private Code code;
	private CodeService codeService;

	private Collection<CodeCommon> codelist;
	private String Encode;
	//默认值
	private String value;
	private String key;
	private String valueTrade;
	private String keyTrade;
	private String valueSource;
	private String keySource;
	private String valueDegree;
	private String keyDegree;

	public String getEncode() {
		return Encode;
	}

	public void setEncode(String encode) {
		Encode = encode;
	}

	public Map<String, String> getAlist() {
		return alist;
	}

	public void setAlist(Map<String, String> alist) {
		this.alist = alist;
	}
	

	@Action("editLinkman2")
	public String edit2() {
		if(customerIds!=null){
			this.customer=this.customerService.get(customerIds[0]);
		}
		return SUCCESS;
	}
	@Action("editDocumenTary")
	public String editDocumenTary() {
		if(customerIds!=null){
			this.customer=this.customerService.get(customerIds[0]);
		}
		this.styles=this.documenTaryStyleService.getAllStyles();
		return SUCCESS;
	}
	
	@Action("testLian")
	public String testLian() {
		return SUCCESS;
	}

	@Action("listCustomer")
	public String execute() {
		return SUCCESS;
	}
	@Action("listCustomerManagement")
	public String listCustomerManagement() {
		return SUCCESS;
	}
	@Action("listCustomerDate")
	public String listCustomerDate() {
		return SUCCESS;
	}
	@Action("listCustomerOA")
	public String listCustomerOA() {
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				Customer.class);
		criteria.add(Restrictions.or(Restrictions.like("sharePerson","%"+AppContext.getAccountContext().currentUser().getResume().getName()+"%"), Restrictions.like("person", "%"+AppContext.getAccountContext().currentUser().getResume().getName()+"%")));
		if(customerAgent!=null){
			criteria.add(Restrictions.eq("customerAgent", customerAgent));
		}
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getCustomerService().listByPage(criteria,
				pagination));
		return SUCCESS;
	}
	@Action("listCustomerAll")
	public String listCustomerAll() {
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				Customer.class);
		if(customerAgent!=null){
			criteria.add(Restrictions.eq("customerAgent", customerAgent));
		}
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getCustomerService().listByPage(criteria,
				pagination));
		return SUCCESS;
	}

	@Action("listCustomerAndProject")
	public String listCustomerAndProject() {
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				Customer.class);
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getCustomerService().listByPage(criteria,
				pagination));
		return SUCCESS;
	}
	@Action("listCustomerByTrade")
	public String listCustomerByTrade() {

		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				Customer.class);
		criteria.add(Restrictions.in("trade", this.getCustomerService()
				.convertToDeptDocTrade(tradeIds)));
		criteria.addOrder(Order.desc("recordTime"));
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getCustomerService().listByPage(criteria,
				pagination));
		return SUCCESS;
	}

	@Action(value = "loadAllCustomer", results = { @Result(name = "success", type = "json", params = {
			"root", "alist" }) })
	public String loadAllCustomer() {
		Collection<Customer> asdf = this.getCustomerService()
				.getCustomerByLay();
		Map<String, String> map = new HashMap<String, String>();
		for (Customer c : asdf) {
			map.put(c.getName(), c.getLatlng() + "," + c.getId());
		}
		alist = map;
		return SUCCESS;
	}

	@Action("selectCustomer")
	public String selectCustomer() {
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				Customer.class);
		criteria.addOrder(Order.desc("recordTime"));
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getCustomerService().listByPage(criteria,
				pagination));
		return SUCCESS;
	}

	@Action("customerByTrade4Select")
	public String selectCustomerByTrade() {
		this.listCustomerByTrade();
		return SUCCESS;
	}

	@Action("alterCustomer")
	public String alterCustomer() {
		return SUCCESS;
	}

	@Action("alterCustomerByTrade")
	public String alterCustomerByTrade() {
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				Customer.class);
		criteria.addOrder(Order.desc("recordTime"));
		pagination = this.getPaginationHelper().prepare(pagination);
		if (tradeIds != null) {
			if (!"all".equals(tradeIds)) {
				tradeIds = tradeIds.split(",")[0];
				if (ToolKits.isInteger(tradeIds)) {
					criteria.createAlias("trade", "tr");
					criteria.add(Restrictions.eq("tr.id", Integer
							.parseInt(tradeIds)));
				}
			}
		}
		this.setPagination(this.getCustomerService().listByPage(criteria,
				pagination));
		return SUCCESS;
	}

	@Action("editCustomer")
	public String edit() {
		if(customerIds!=null){
			this.customer=this.customerService.get(customerIds[0]);
			this.customerAgent=this.customer.getCustomerAgent();
		}else{
			this.codeNumber=this.codeNumberService.getCodeByState("客户");
		}
		this.codelist = this.getCodeCommonService().getCodeCommonByCodeType(
				"客户");
//		this.levels = this.getCustomerLevelService().getAllCustomerLevel();
//		this.types = this.getCustomerTypeService().getAllCustomerType();
		this.trades = this.getCustomerTradeService().getAllCustomerTrade();
		if(this.customer==null){
			for(int i=0;i<trades.size();i++){
				CustomerTrade t=trades.get(i);
				if(t.getRemark()!=null){
					this.valueTrade=t.getName();
					this.keyTrade=t.getId().toString();
					trades.remove(t);
				}
			}
		}
		this.addresses=this.customerAddressService.getalladdress();
		
		if(this.customer==null){
		for(int i=0;i<addresses.size();i++){
			CustomerAddress ad=addresses.get(i);
			if(ad.getRemark()!=null){
				this.value=ad.getName();
				this.key=ad.getId().toString();
				addresses.remove(ad);
			}
		}}
		this.sources=this.customerSourceService.getAllSources();
		if(this.customer==null){
			for(int i=0;i<sources.size();i++){
				CustomerSource s=sources.get(i);
				if(s.getRemark()!=null){
					this.valueSource=s.getName();
					this.keySource=s.getId().toString();
					sources.remove(s);
				}
			}
		}
		this.degrees=this.customerDegreeService.getAllDegree();
		if(this.customer==null){
			for(int i=0;i<degrees.size();i++){
				CustomerDegree d=degrees.get(i);
				if(d.getRemark()!=null){
					this.valueDegree=d.getName();
					this.keyDegree=d.getId().toString();
					degrees.remove(d);
				}
			}
		}
		this.saless=this.customerSalesService.getAllSales();
		
		return SUCCESS;
	}
	@Action("editProject")
	public String editProject() {
		if(projectIds!=null){
			this.customerProject=this.customerProjectService.get(projectIds[0]);
			this.customer=this.customerProject.getCustomer();
		}else{
			this.codeNumber=this.codeNumberService.getCodeByState("项目");
		}
		if(customerIds!=null){
			customer=this.customerService.get(customerIds[0]);
		}else{
			this.codeNumber=this.codeNumberService.getCodeByState("项目");
		}
		return SUCCESS;
	}

	@Action(value = "textNet", results = { @Result(name = "success", type = "json", params = {
			"root", "text" }) })
	public String textNet() {
		String asdf = "";
		Runtime runtime = Runtime.getRuntime();
		Process process = null;
		String line = null;
		InputStream is = null;
		InputStreamReader isr = null;
		BufferedReader br = null;
		String ip = "www.baidu.com";
		try {

			process = runtime.exec("ping " + ip);
			is = process.getInputStream();
			isr = new InputStreamReader(is);
			br = new BufferedReader(isr);
			while ((line = br.readLine()) != null) {
				asdf = asdf + line;
			}
			is.close();
			isr.close();
			br.close();
		} catch (IOException e) {
			// out.println(e);
			runtime.exit(1);
		}
		if (asdf.length() > 100) {
			// System.out.println(asdf.length());
			text = true;
		} else {
			text = false;
		}
		return SUCCESS;
	}

	@Action("viewCustomer")
	public String view() {
		if(customerIds!=null){
			this.customer=this.customerService.get(customerIds[0]);
		}
		this.tarys=this.documenTaryService.getTaryByid(customer); //跟单信息
		this.linkmans=this.linkmanService.getLinkmanByCustomer(customer); //联系人信息
		this.projects=this.customerProjectService.getProjectByCustomer(customer); //项目信息
		return SUCCESS;
	}

	@Action(value = "findCityByProvice", results = { @Result(name = "success", type = "json", params = {
			"root", "cities" }) })
	public String findCityByProvince() {
		// System.out.println(province.getProvinceName()+"   "+province.getId());
		//cities = (ArrayList<City>) this.getCityService().getCityByProvince(
				//province);

		return SUCCESS;
	}

	@Action(value = "findAreasByCity", results = { @Result(name = "success", type = "json", params = {
			"root", "areas" }) })
	public String findAreasByCity() {
		//areas = (ArrayList<Areas>) this.getAreasService().getByCity(city);
		return SUCCESS;
	}

	@Clew(results = { "success", "none" })
	@Action(value = "saveCustomer", results = {
			@Result(name = "success", type = "redirect", location = "listCustomerOA"),
			@Result(name = "none", type = "redirect", location = "alterCustomer"),
			@Result(name = "error", type = "chain", location = "editCustomer") })
	public String save() {
		
//		if (isnull(customer.getMobileNo())) {
//			if (!ToolKits.isInteger(customer.getMobileNo())) {
//				this.addActionError("手机号只能由数字构成!请重新输入");
//				return ERROR;
//			}
//		}
//		String emailString = "\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+";// "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+ ([-.]\\w+)*";
//
//		Pattern p = Pattern.compile(emailString);
//		Matcher m = p.matcher(customer.getEmail().trim());
//		boolean b = m.matches();
//		if (!"".equals(customer.getEmail().trim()) && !b) {
//			addActionError("电子邮件格式不正确");
//			return ERROR;
//		}
		if(upload!=null){
			customer.setAttach(FileUtil.getInstance().createAttach(upload, uploadFileName));
		}
		if (customer.getId() == null) {
			if (this.getCustomerService().existSameCustomer(customer.getName())) {
				this.addActionError("已录入相同名称的客户");
				return ERROR;
			}
			customer.setState(Constrains.TASK_AUDITING);
			customer.setRecorder(AppContext.getAccountContext().currentUser());
			this.getCustomerService().save(customer);
			String edit=this.codeNumber.getEdit();
			String sample=this.codeNumber.getSample();
			String[] ee=edit.split(",");
			String[] ss=sample.split(",");
			List<String> list=new ArrayList<String>();
			for(int i=0;i<ee.length;i++){
				String samp="";
				if(ee[i].equals("##")){
					int bb=Integer.parseInt(ss[i]);
					bb=bb+1;
					String b="";
					for(int a=0;a<ss[i].length()-String.valueOf(bb).length();a++){
						b=b+"0";
					}
					samp=b+bb;
					ss[i]=samp;
				}
				if(i==ee.length-1){
					list.add(ss[i]);
				}else{
					list.add(ss[i]+",");
				}
			}
			String d="";
			String q="";
			for(int i=0;i<list.size();i++){
				d=d+list.get(i);
			}
			String[] dd=d.split(",");
			for(int i=0;i<dd.length;i++){
				q=q+dd[i];
			}
			this.codeNumber.setSample(d);
			this.codeNumber.setCodeSample(q);
			int now=Integer.parseInt(codeNumber.getNowCode())+1;
			this.codeNumber.setNowCode(String.valueOf(now));
			this.codeNumberService.submit(codeNumber);
			this.setPrompt("录入客户成功");
		} else {
			if(customerAgent!=null){
				this.customer.setCustomerAgent(customerAgent);
			}
			if(upload!=null){
			this.getCustomerService().saveCustomers(customer, upload,
					uploadFileName);
			}else{
				this.customerService.submit(customer);
			}
			this.setPrompt("变更客户成功");
		}

		return SUCCESS;
	}
	

	@Action(value = "removeCustomer", results = {
			@Result(name = "success", type = "redirect", location = "listCustomerOA"),
			@Result(name = "error", type = "chain", location = "listCustomerOA") })
	public String remove() {
			for(int i=0;i<customerIds.length;i++){
				Customer cus=this.customerService.get(customerIds[0]);
				projects=this.customerProjectService.getProjectByCustomer(cus);  //查询是否有关联项目
				if(projects!=null){
					for(CustomerProject pro:projects){
						this.customerProjectService.remove(pro);
					}
				}
				linkmans=this.linkmanService.getLinkmanByCustomer(cus); //查询客户关联的联系人
				if(linkmans!=null){
					for(Linkman link:linkmans){
						this.linkmanService.remove(link);
					}
				}
				tarys=this.documenTaryService.getTaryByid(cus); //查询卡客户关联跟单
				if(tarys!=null){
					for(DocumenTary doc:tarys){
						this.documenTaryService.remove(doc);
					}
				}
				this.getCustomerService().remove(cus);
			}
			return SUCCESS;
	}

	@Action("editAlterCustomerLevel")
	public String editAlterCustomerLevel() {
		this.levels = this.getCustomerLevelService().getAllCustomerLevel();
		this.types = this.getCustomerTypeService().getAllCustomerType();
		this.trades = this.getCustomerTradeService().getAllCustomerTrade();
		return SUCCESS;
	}

	@Clew(results = { "success" })
	@Action(value = "submitAlterCustomerLevel", results = { @Result(name = "success", type = "redirect", location = "history.back()") })
	public String submitAlterCustomerLevel() {
		return SUCCESS;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public CustomerService getCustomerService() {
		return customerService;
	}

	public void setCustomerService(CustomerService customerService) {
		this.customerService = customerService;
	}

	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}

	public Integer[] getCustomerIds() {
		return customerIds;
	}

	public void setCustomerIds(Integer[] customerIds) {
		this.customerIds = customerIds;
	}

	public File getUpload() {
		return upload;
	}

	public void setUpload(File upload) {
		this.upload = upload;
	}

	public String getUploadFileName() {
		return uploadFileName;
	}

	public void setUploadFileName(String uploadFileName) {
		this.uploadFileName = uploadFileName;
	}

	public List<CustomerLevel> getLevels() {
		return levels;
	}

	public void setLevels(List<CustomerLevel> levels) {
		this.levels = levels;
	}

	public List<CustomerType> getTypes() {
		return types;
	}

	public void setTypes(List<CustomerType> types) {
		this.types = types;
	}

	public List<CustomerTrade> getTrades() {
		return trades;
	}

	public void setTrades(List<CustomerTrade> trades) {
		this.trades = trades;
	}

	public void setCustomerTradeService(
			CustomerTradeService customerTradeService) {
		this.customerTradeService = customerTradeService;
	}

	public CustomerTradeService getCustomerTradeService() {
		return customerTradeService;
	}

	public void setCustomerTypeService(CustomerTypeService customerTypeService) {
		this.customerTypeService = customerTypeService;
	}

	public CustomerTypeService getCustomerTypeService() {
		return customerTypeService;
	}

	public void setCustomerLevelService(
			CustomerLevelService customerLevelService) {
		this.customerLevelService = customerLevelService;
	}

	public CustomerLevelService getCustomerLevelService() {
		return customerLevelService;
	}

	public void setTradeIds(String tradeIds) {
		this.tradeIds = tradeIds;
	}

	public String getTradeIds() {
		return tradeIds;
	}

	public boolean isText() {
		return text;
	}

	public void setText(boolean text) {
		this.text = text;
	}

	public CodeCommon getCodeCommon() {
		return codeCommon;
	}

	public void setCodeCommon(CodeCommon codeCommon) {
		this.codeCommon = codeCommon;
	}

	public CodeCommonService getCodeCommonService() {
		return codeCommonService;
	}

	public void setCodeCommonService(CodeCommonService codeCommonService) {
		this.codeCommonService = codeCommonService;
	}

	public Code getCode() {
		return code;
	}

	public void setCode(Code code) {
		this.code = code;
	}

	public CodeService getCodeService() {
		return codeService;
	}

	public void setCodeService(CodeService codeService) {
		this.codeService = codeService;
	}

	public Collection<CodeCommon> getCodelist() {
		return codelist;
	}

	public void setCodelist(Collection<CodeCommon> codelist) {
		this.codelist = codelist;
	}


	public static String Increase(String backupNum) {
		String Inc = "";
		int lengths = backupNum.length();
		String lengthss = (Integer.parseInt(backupNum) + 1) + "";
		int increase = (lengthss.trim()).length();
		if (lengths != increase) {
			String In = "";
			for (int i = 0; i < lengths - increase; i++) {
				In = In + "0";
			}
			In = (In + lengthss).trim();
			Inc = In;
		} else {
			Inc = lengthss;
		}
		return Inc.trim();
	}
	public boolean isphone(String str) {
		boolean tag = false;
		final String pattern = "[1]{1}[3,5,8,6]{1}[0-9]{9}";
		final Pattern patt = Pattern.compile(pattern);
		final Matcher mat2 = patt.matcher(str);
		if (!mat2.find()) {
			tag = true;
		}
		return tag;
	}

	public boolean isnull(String str) {
		boolean s = true;
		if (str.equals("") || str == null) {
			s = false;
		}
		return s;
	}

	public String getUplodS() {
		return uplodS;
	}

	public void setUplodS(String uplodS) {
		this.uplodS = uplodS;
	}
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public List<DocumenTary> getTarys() {
		return tarys;
	}

	public void setTarys(List<DocumenTary> tarys) {
		this.tarys = tarys;
	}

	public DocumenTaryService getDocumenTaryService() {
		return documenTaryService;
	}

	public void setDocumenTaryService(DocumenTaryService documenTaryService) {
		this.documenTaryService = documenTaryService;
	}

	public LinkmanService getLinkmanService() {
		return linkmanService;
	}

	public void setLinkmanService(LinkmanService linkmanService) {
		this.linkmanService = linkmanService;
	}

	public List<Linkman> getLinkmans() {
		return linkmans;
	}

	public void setLinkmans(List<Linkman> linkmans) {
		this.linkmans = linkmans;
	}

	public List<CustomerProject> getProjects() {
		return projects;
	}

	public void setProjects(List<CustomerProject> projects) {
		this.projects = projects;
	}

	public CustomerProjectService getCustomerProjectService() {
		return customerProjectService;
	}

	public void setCustomerProjectService(
			CustomerProjectService customerProjectService) {
		this.customerProjectService = customerProjectService;
	}

	public CustomerAgent getCustomerAgent() {
		return customerAgent;
	}

	public void setCustomerAgent(CustomerAgent customerAgent) {
		this.customerAgent = customerAgent;
	}

	public Integer[] getProjectIds() {
		return projectIds;
	}

	public void setProjectIds(Integer[] projectIds) {
		this.projectIds = projectIds;
	}

	public CustomerProject getCustomerProject() {
		return customerProject;
	}

	public void setCustomerProject(CustomerProject customerProject) {
		this.customerProject = customerProject;
	}

	public List<CustomerAddress> getAddresses() {
		return addresses;
	}

	public void setAddresses(List<CustomerAddress> addresses) {
		this.addresses = addresses;
	}

	public CustomerAddressService getCustomerAddressService() {
		return customerAddressService;
	}

	public void setCustomerAddressService(
			CustomerAddressService customerAddressService) {
		this.customerAddressService = customerAddressService;
	}

	public List<CustomerSource> getSources() {
		return sources;
	}

	public void setSources(List<CustomerSource> sources) {
		this.sources = sources;
	}

	public CustomerSourceService getCustomerSourceService() {
		return customerSourceService;
	}

	public void setCustomerSourceService(CustomerSourceService customerSourceService) {
		this.customerSourceService = customerSourceService;
	}

	public List<CustomerDegree> getDegrees() {
		return degrees;
	}

	public void setDegrees(List<CustomerDegree> degrees) {
		this.degrees = degrees;
	}

	public CustomerDegreeService getCustomerDegreeService() {
		return customerDegreeService;
	}

	public void setCustomerDegreeService(CustomerDegreeService customerDegreeService) {
		this.customerDegreeService = customerDegreeService;
	}

	public List<DocumenTaryStyle> getStyles() {
		return styles;
	}

	public void setStyles(List<DocumenTaryStyle> styles) {
		this.styles = styles;
	}

	public DocumenTaryStyleService getDocumenTaryStyleService() {
		return documenTaryStyleService;
	}

	public void setDocumenTaryStyleService(
			DocumenTaryStyleService documenTaryStyleService) {
		this.documenTaryStyleService = documenTaryStyleService;
	}

	public List<CustomerSales> getSaless() {
		return saless;
	}

	public void setSaless(List<CustomerSales> saless) {
		this.saless = saless;
	}

	public CustomerSalesService getCustomerSalesService() {
		return customerSalesService;
	}

	public void setCustomerSalesService(CustomerSalesService customerSalesService) {
		this.customerSalesService = customerSalesService;
	}

	public CodeNumber getCodeNumber() {
		return codeNumber;
	}

	public void setCodeNumber(CodeNumber codeNumber) {
		this.codeNumber = codeNumber;
	}

	public CodeNumberService getCodeNumberService() {
		return codeNumberService;
	}

	public void setCodeNumberService(CodeNumberService codeNumberService) {
		this.codeNumberService = codeNumberService;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValueSource() {
		return valueSource;
	}

	public void setValueSource(String valueSource) {
		this.valueSource = valueSource;
	}

	public String getKeySource() {
		return keySource;
	}

	public void setKeySource(String keySource) {
		this.keySource = keySource;
	}

	public String getValueTrade() {
		return valueTrade;
	}

	public void setValueTrade(String valueTrade) {
		this.valueTrade = valueTrade;
	}

	public String getKeyTrade() {
		return keyTrade;
	}

	public void setKeyTrade(String keyTrade) {
		this.keyTrade = keyTrade;
	}

	public String getValueDegree() {
		return valueDegree;
	}

	public void setValueDegree(String valueDegree) {
		this.valueDegree = valueDegree;
	}

	public String getKeyDegree() {
		return keyDegree;
	}

	public void setKeyDegree(String keyDegree) {
		this.keyDegree = keyDegree;
	}
	
}
